//
//  LnviteExpertsCell.m
//  CYWFrame
//
//  Created by Macx on 2017/9/26.
//  Copyright © 2017年 Macx. All rights reserved.
//

#import "LnviteExpertsCell.h"
#import "User.h"

@implementation LnviteExpertsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.headPic.frame = CGRectMake(10, 10, SW(10), SW(10));
    self.headPic.layer.cornerRadius = self.headPic.height/2;
    self.headPic.layer.masksToBounds = YES;
    
    self.role.frame = CGRectMake(self.headPic.x+self.headPic.width/3*2, self.headPic.y+self.headPic.height/3*2, self.headPic.width/3, self.headPic.width/3);
    self.role.image = IMAGE(@"icon_add_v_expert");
    
    self.invitation.titleLabel.font = kUHSystemFontWithSize(13);
    CGSize btnS = [LZCTools textSizeWithText:@"已邀约" font:kUHSystemFontWithSize(13)];
    CGFloat btnW = btnS.width+20;
    CGFloat btnH = btnS.height+10;
    self.invitation.frame = CGRectMake(SCREEN_WIDTH-10-btnW, 0, btnW, btnH);
    self.invitation.centerY = self.headPic.centerY;
    
    [self.invitation setTitle:@"邀约" forState:UIControlStateNormal];
    [self.invitation setTitle:@"已邀约" forState:UIControlStateSelected];
    
    self.nickName.font = kUHSystemFontWithSize(13);
    CGFloat nickX = self.headPic.x+self.headPic.width+10;
    self.nickName.frame = CGRectMake(nickX, self.headPic.y, SCREEN_WIDTH-nickX-btnW-10, self.headPic.height);
    
}

- (void)setModel:(User *)model {
    if (_model != model) {
        _model = model;
        
        [self.headPic sd_setImageWithURL:[NSURL URLWithString:model.face] placeholderImage:IMAGE(@"placeHolder")];
        self.nickName.text = model.nickname;
        
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
